package com.nbsaas.boot.blockchain.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.util.Date;

/**
 * 区块链智能合约实体类
 * 
 * @author 系统生成
 */
@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "区块链智能合约", model = "区块链智能合约")
@Entity
@Table(name = "bs_blockchain_contract")
@Comment("区块链智能合约表")
public class BlockchainContract extends AbstractEntity {

    @Comment("合约哈希")
    @SearchItem(name = "contractHash", key = "contractHash", label = "合约哈希")
    @FormField(title = "合约哈希", sortNum = "1", grid = true, required = true)
    @Column(name = "contract_hash", length = 64, nullable = false, unique = true)
    private String contractHash;

    @Comment("合约类型")
    @SearchItem(name = "contractType", key = "contractType", label = "合约类型")
    @FormField(title = "合约类型", sortNum = "2", grid = true, type = InputType.select)
    @Column(name = "contract_type", length = 50)
    private String contractType; // PAYMENT-支付合约, QUALITY_CHECK-质量检验合约, LOGISTICS-物流合约, SUPPLY_CHAIN-供应链合约

    @Comment("参与方")
    @FormField(title = "参与方", sortNum = "3", type = InputType.textarea)
    @Column(name = "parties_involved", columnDefinition = "TEXT")
    private String partiesInvolved;

    @Comment("合约条款")
    @FormField(title = "合约条款", sortNum = "4", type = InputType.textarea)
    @Column(name = "contract_terms", columnDefinition = "TEXT")
    private String contractTerms;

    @Comment("执行条件")
    @FormField(title = "执行条件", sortNum = "5", type = InputType.textarea)
    @Column(name = "execution_conditions", columnDefinition = "TEXT")
    private String executionConditions;

    @Comment("合约状态")
    @FormField(title = "合约状态", sortNum = "6", grid = true, type = InputType.select)
    @Column(name = "contract_status", length = 20)
    private String contractStatus; // DRAFT-草稿, ACTIVE-已激活, EXECUTED-已执行, EXPIRED-已过期, CANCELLED-已取消

    @Comment("创建时间")
    @FormField(title = "创建时间", sortNum = "7", type = InputType.date, grid = true)
    @Column(name = "creation_time")
    private Date creationTime;

    @Comment("执行时间")
    @FormField(title = "执行时间", sortNum = "8", type = InputType.date, grid = true)
    @Column(name = "execution_time")
    private Date executionTime;

    @Comment("合约金额")
    @FormField(title = "合约金额", sortNum = "9", grid = true, type = InputType.el_input_number)
    @Column(name = "contract_amount", precision = 15, scale = 2)
    private java.math.BigDecimal contractAmount;

    @Comment("合约描述")
    @FormField(title = "合约描述", sortNum = "10", type = InputType.textarea)
    @Column(name = "description", length = 1000)
    private String description;
} 